<template>
  <van-row class="hu-check-btn">
    <van-col span="6">
      <div class="hu-check-btn-left" @click="onCheck(!value)">
        <van-checkbox :value="value">{{checkText}}</van-checkbox>
      </div>
    </van-col>
    <van-col span="18">
      <van-button class="hu-button--submit" @click="onComfirm">{{btnText}}</van-button>
    </van-col>
  </van-row>
</template>

<script>
export default {
  name: "HuCheckBtn",
  model: {
    props: "value",
    event: "update",
  },
  props: {
    checkText: {
      type: String,
      default: "全选",
    },
    // 是否选中
    value: {
      type: Boolean,
      default: false,
    },
    // 按钮文字
    btnText: {
      type: String,
      default: "确定",
    },
  },
  data() {
    return {};
  },
  methods: {
    onCheck(val) {
      this.$emit("update", val);
      this.$emit("change", val);
    },
    onComfirm() {
      this.$emit("confirm");
    },
  },
};
</script>

<style lang="less" scoped>
.hu-check-btn-left {
  height: 64px;
  line-height: 64px;
  padding-left: 20px;
  display: flex;
  align-items: center;
}
</style>